Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use PMCD returned by mappinganalysis to build minimal graph for query #3488

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

YannanGao-gs
Copy link
Contributor

@YannanGao-gs YannanGao-gs commented Aug 30, 2024

Summary

Use PMCD returned by mappinganalysis to build minimal graph for query

clean/update: #2523

How did you test this change?

  • Test(s) added
  • Manual testing (please provide screenshots/recordings)
  • No testing (please provide an explanation)
Screen.Recording.2024-09-26.at.10.28.48.PM.mov

enable switch to load full graph

Screen.Recording.2024-09-26.at.10.27.01.PM.mov

@YannanGao-gs YannanGao-gs requested a review from a team as a code owner August 30, 2024 21:14
@YannanGao-gs YannanGao-gs marked this pull request as draft August 30, 2024 21:14
Copy link

changeset-bot bot commented Aug 30, 2024

🦋 Changeset detected

Latest commit: b505283

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 29 packages
Name Type
@finos/legend-extension-dsl-data-space Minor
@finos/legend-application-query Minor
@finos/legend-extension-dsl-data-space-studio Patch
@finos/legend-application-studio Patch
@finos/legend-query-builder Patch
@finos/legend-server-depot Patch
@finos/legend-graph Patch
@finos/legend-application-query-bootstrap Patch
@finos/legend-application-studio-bootstrap Patch
@finos/legend-extension-dsl-data-quality Patch
@finos/legend-extension-dsl-service Patch
@finos/legend-extension-assortment Patch
@finos/legend-extension-dsl-diagram Patch
@finos/legend-extension-dsl-persistence Patch
@finos/legend-extension-dsl-text Patch
@finos/legend-extension-store-flat-data Patch
@finos/legend-extension-store-relational Patch
@finos/legend-extension-store-service-store Patch
@finos/legend-vscode-extension-dependencies Patch
@finos/legend-application-pure-ide Patch
@finos/legend-application-repl Patch
@finos/legend-code-editor Patch
@finos/legend-data-cube Patch
@finos/legend-lego Patch
@finos/legend-application-query-deployment Patch
@finos/legend-application-studio-deployment Patch
@finos/legend-application-pure-ide-deployment Patch
@finos/legend-application-repl-deployment Patch
@finos/legend-server-showcase-deployment Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@YannanGao-gs YannanGao-gs self-assigned this Aug 30, 2024
Copy link

codecov bot commented Aug 30, 2024

Codecov Report

Attention: Patch coverage is 17.78976% with 1220 lines in your changes missing coverage. Please review.

Project coverage is 45.37%. Comparing base (595e28d) to head (b505283).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
...e/v1/V1_DSL_DataSpace_PureGraphManagerExtension.ts 4.76% 300 Missing ⚠️
...c/components/Core_LegendQueryApplicationPlugin.tsx 14.59% 240 Missing ⚠️
...s/data-space/DataSpaceTemplateQueryCreatorStore.ts 8.50% 183 Missing ⚠️
...rc/stores/data-space/DataSpaceQueryCreatorStore.ts 5.83% 129 Missing ⚠️
...d-application-query/src/stores/QueryEditorStore.ts 23.03% 127 Missing ⚠️
...components/query-builder/DataSpaceQueryBuilder.tsx 0.00% 40 Missing ⚠️
...stores/query-builder/DataSpaceQueryBuilderState.ts 0.00% 34 Missing ⚠️
.../QueryBuilder_LegendApplicationPlugin_Extension.ts 0.00% 28 Missing ⚠️
...r/action/analytics/MappingModelCoverageAnalysis.ts 10.34% 26 Missing ⚠️
...r/src/stores/workflows/ServiceQueryBuilderState.ts 0.00% 19 Missing ⚠️
... and 19 more
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3488      +/-   ##
==========================================
- Coverage   45.48%   45.37%   -0.11%     
==========================================
  Files        2168     2168              
  Lines      374901   376075    +1174     
  Branches    16060    10807    -5253     
==========================================
+ Hits       170527   170654     +127     
- Misses     203683   204730    +1047     
  Partials      691      691              
Files with missing lines Coverage Δ
...src/__lib__/DSL_DataSpace_LegendQueryNavigation.ts 59.84% <100.00%> (+0.64%) ⬆️
...ry/src/application/LegendQueryApplicationConfig.ts 98.41% <100.00%> (+0.02%) ⬆️
...s/__test-utils__/QueryEditorComponentTestUtils.tsx 100.00% <100.00%> (ø)
...-query/src/stores/LegendQueryApplicationPlugin.tsx 100.00% <100.00%> (ø)
...r-group/mapping-editor/MappingExecutionBuilder.tsx 58.41% <100.00%> (ø)
...ng-editor/legacy/DEPRECATED__MappingTestEditor.tsx 69.47% <100.00%> (ø)
...itor/editor-group/uml-editor/ClassQueryBuilder.tsx 42.11% <100.00%> (ø)
...dio/src/stores/editor/EmbeddedQueryBuilderState.ts 79.66% <100.00%> (+0.17%) ⬆️
...ol/pure/DSL_DataSpace_PureGraphManagerExtension.ts 92.13% <100.00%> (+1.85%) ⬆️
...gend-graph/src/graph-manager/action/query/Query.ts 40.96% <100.00%> (ø)
... and 30 more

... and 34 files with indirect coverage changes

@YannanGao-gs YannanGao-gs force-pushed the performanceEnhance branch 3 times, most recently from 2375853 to b8520b0 Compare September 3, 2024 20:27
@YannanGao-gs YannanGao-gs marked this pull request as ready for review September 3, 2024 20:27
@YannanGao-gs YannanGao-gs marked this pull request as draft September 3, 2024 20:29
@YannanGao-gs YannanGao-gs force-pushed the performanceEnhance branch 3 times, most recently from aab4beb to e84388e Compare September 4, 2024 13:26
@YannanGao-gs
Copy link
Contributor Author

YannanGao-gs commented Sep 4, 2024

HEADS-UP:

To fix (regressions)

  • about dataspace will not work due to missing connection (modify result json to have connection path)
  • dataspace template query is not working due to empty executables
  • either add diagram analyze coverage in engine or bypass diagram check in secondpass in studio

@YannanGao-gs YannanGao-gs marked this pull request as ready for review September 26, 2024 16:27
@YannanGao-gs YannanGao-gs changed the title WIP: Use PMCD returned by mappinganalysis to build minimal graph for query Use PMCD returned by mappinganalysis to build minimal graph for query Sep 26, 2024
@YannanGao-gs YannanGao-gs force-pushed the performanceEnhance branch 3 times, most recently from 3dab2fd to 2d8d949 Compare September 27, 2024 02:31
packages/legend-graph/src/graph/helpers/DomainHelper.ts Outdated Show resolved Hide resolved
mapping!: PackageableElementReference<Mapping>;
runtime!: PackageableElementReference<PackageableRuntime>;
// NOTE: Query can be built before the actual graph is built so we can't have the reference of metamodels here
mapping!: string;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need to make this change, shouldnt the graph already be build with a stub mapping and runtime for this not to have to change ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

setUpEdtiorState() has been updated to fetch query instead of LightQuery anymore
https://github.com/finos/legend-studio/pull/3488/files#diff-5dae4710ada9d402191df7256d5cc7d4502e3b40a8f1b9acf960143f7ee6adfeR1293

Therefore, it needs to be changed to use string

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is the reasoning for this change.
We have 3 models for Stored Query.
Query, Light Query and Query Info.
The Query one should be the compiled resolved one if we ever need it. the other two are unresolved ones using string paths etc.
So we should not be changing Query to strings.
Depends on what exactly you need in scope.
Maybe you just need QueryInfo ?

@@ -39,13 +39,14 @@ export enum DATA_SPACE_TEMPLATE_QUERY_CREATOR_ROUTE_PATTERN_TOKEN {
GAV = 'gav',
DATA_SPACE_PATH = 'dataSpacePath',
TEMPLATE = 'template',
EXECUTION_CONTEXT = 'executionContext',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dont think we need this.

@@ -39,6 +39,7 @@ export enum DATA_SPACE_TEMPLATE_QUERY_CREATOR_ROUTE_PATTERN_TOKEN {
GAV = 'gav',
DATA_SPACE_PATH = 'dataSpacePath',
TEMPLATE = 'template',
EXECUTION_CONTEXT = 'executionContext',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dont think this is needed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is needed as when trying to build minimal graph, mapping and pmcd are fetched from corresponding sexecutionContext key

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still don't understand. DataspaceInfo should have the template info( which we get from the template id) which has the executon context we need ? right

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the entry point of building DataspaceAnalyticsResult and light graph is built when building DataspaceAnalyticsResult.
Based on current implementation, template info is built at the last step

@@ -63,6 +65,10 @@ export type NewQueryNavigationPath = (
editorStore: ExistingQueryEditorStore,
) => string | undefined;

export type QueryGraphBuilderGetter = (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where is this used ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is used in https://github.com/finos/legend-studio/pull/3488/files#diff-5dae4710ada9d402191df7256d5cc7d4502e3b40a8f1b9acf960143f7ee6adfeR690
This is for loading an empty function to aovid buildFullGraph for ExistingQueryEditorStore with dataspace context only

Copy link
Member

@MauricioUyaguari MauricioUyaguari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need a better strategy for the things we have started caching that just a bunch of ifs and checking for info. I think we should change the source of truth for UI to be dataspace info on some of the dataspace specific feature. Im worried about the cost to maintain a lot of this code or even to test it is great.

I think how we built the dataspace info will be determined by whether we get the info from the full graph or the cache dataspace analysis result.
We may want to have a method to determine that this dataspace analysis result is expected to have all this new info (executable and template stuff), maybe adding a version on analysis result and saying if it has version x then we know it has all these fields are expected. Or maybe if the minimal graph is there then we know that it is expected to have this new info. If it has all this new info then we use the cached datasapce info to built it, if not we use the full graph to build this dataspace info.
From the dataspace info is all we need to render these helper forms.

@YannanGao-gs YannanGao-gs force-pushed the performanceEnhance branch 2 times, most recently from 1296d4d to 70164b2 Compare October 3, 2024 22:11
@YannanGao-gs YannanGao-gs marked this pull request as draft October 4, 2024 00:00
@YannanGao-gs YannanGao-gs marked this pull request as ready for review October 4, 2024 01:31
mapping!: PackageableElementReference<Mapping>;
runtime!: PackageableElementReference<PackageableRuntime>;
// NOTE: Query can be built before the actual graph is built so we can't have the reference of metamodels here
mapping!: string;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is the reasoning for this change.
We have 3 models for Stored Query.
Query, Light Query and Query Info.
The Query one should be the compiled resolved one if we ever need it. the other two are unresolved ones using string paths etc.
So we should not be changing Query to strings.
Depends on what exactly you need in scope.
Maybe you just need QueryInfo ?

return queryExeContext;
}

async propagateExecutionContextChange(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[can help] I don't think the extension (getExtraQueryBuilderPropagateExecutionContextChangeHelper) makes much sense. Looking at the implementation you are using only the flags of QueryEditorStore. Maybe we can add include if we use the minimal graph as an input to DataSpaceQueryBuilderState

We should be able to use the input to implement this in DataSpaceQueryBuilderState. We have
onExecutionContextChange
and should have the flags needed in scope

supportBuildMinimalGraph
) {
try {
const stopWatch = new StopWatch();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

additionally below code is repeated.
We should have a buildDataspaceMinialGraph in V1_DSL_DataSpace_PureGraphManagerExtension that takes in minimalEntities, dataspaceInfo, executionKeyToBuild,
and builds the required graph. I think we already have this logic in V1_DSL_DataSpace_PureGraphManagerExtension

@@ -603,6 +603,12 @@ export const QueryEditor = observer(() => {
!engineConfig.useClientRequestPayloadCompression,
);

const toggleEnableMinialGraphForDataSpaceLoadingPerformance = (): void => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doesnt this change the local storage value ?

@MauricioUyaguari
Copy link
Member

the changes to the editors to take info look good (took a quick look) but we need to add tests for these rendering components. do we have any at the moment, didnt see we change any so i assume we don't ?

@YannanGao-gs YannanGao-gs force-pushed the performanceEnhance branch 3 times, most recently from 8cc3319 to 987b5c7 Compare October 18, 2024 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants